package util;


public class MyCompare implements SortCompare{
    @Override
    public int compare(Object prev, Object next) {
//        if((Integer)prev > (Integer)next){
//            return -1;
//        }else if((Integer)prev < (Integer)next){
//            return 1;
//        }else{
//            return 0;
//        }
        Auto car1 = (Auto) prev;
        Auto car2 = (Auto) next;
        if(car1.getSpeed() < car2.getSpeed()){
            return -1;
        }else if(car1.getSpeed() > car2.getSpeed()){
            return 1;
        }else{
            return 0;
        }
    }
}
